package com.bupt.kgplatform.Util;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bupt.kgplatform.entity.User;
import lombok.Data;

/**
 * PageInfo
 *
 * @author zrz
 * @date 2024/5/28
 * @time 22:13
 * @Description 分页信息
 */

@Data
public class PageInfo {
    private Boolean hasNext;
    private Boolean hasPrevious;
    private Long pages;
    private Long total;
    private Long size;
    private Long current;

    public <T> PageInfo(Page<T> page){
        this.current = page.getCurrent();
        this.hasPrevious = page.hasPrevious();
        this.total = page.getTotal();
        this.pages = page.getPages();
        this.size = page.getSize();
        this.hasNext = page.hasNext();
    }

}
